export const state = () => ({
	// userid: localStorage.getItem('userid'),
	// token: localStorage.getItem('token'),   
	// name: localStorage.getItem('name'),   
	// auth: Boolean(localStorage.getItem('auth')), //区分是否登录  true登录
	userid: '',
	token: '',   
	name: '',   
	auth: false, //区分是否登录  true登录
})
export const mutations = {
	setUser(state,n){
		// 循环遍历对象 
		Object.assign(state, n);
		for(let i in n) {
			localStorage.setItem(i,n[i])
		}
	},
	removeUser(state,n) { //退出登录
		for(let i in state) {
			localStorage.removeItem(state[i])
			state[i] = '' //设置为空
			if (i === 'auth') { //设置为false
				state[i] = false
			}
		}
	}
}